#pragma once

#include "Producer.h"
#include "EnvelopeParameters.h"
#include "../common.h"

namespace AudioEngine
{
	class VolumeEnvelope : public Producer
	{
		sp<Producer> inner_producer;
		EnvelopeParameters parameters;
		mutable int last_requested_rample;
		int first_sample_of_release;
		bool release_mode;
		mutable float last_coef;

	public:
		VolumeEnvelope(sp<Producer> inner_roducer, EnvelopeParameters const& parameters);

		/*override*/ float get_sample(int index) const;
		/*override*/ void key_release();
	};
}
